package com.icarus.entity;


import com.icarus.view.MainView;

import javax.swing.*;

/**
 *  场景
 */
public class Scene implements Runnable {


    //场景等级
    private int level;

    //场景图标
    private ImageIcon icon;

    //场景坐标
    private int x;

    private int y;

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public ImageIcon getIcon() {
        return icon;
    }

    public void setIcon(ImageIcon icon) {
        this.icon = icon;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(100);

                this.y = this.y + 5;
                //超过背景图则置0 重新滚动
                if(this.y>= MainView.HEIGHT) {
                    this.y = 0;
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
